package com.cowin.inf.dao;

import com.cowin.base.Mapper;
import com.cowin.inf.model.KyBdcVehicle;
import com.cowin.sys.model.vo.OnLineMakeVehicle;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface KyBdcVehicleMapper extends Mapper<KyBdcVehicle> {
    @Select("SELECT * from KY_BDC_VEHICLE where vin =#{vin}")
    List<KyBdcVehicle> findByVin(@Param("vin") String vin);

    @Select("SELECT TM_VHC_VEHICLE.FRAME_NO,TM_VHC_VEHICLE.MATERIAL_NO,TM_BAS_MATERIAL_RELATION.MATERIAL_DESC,TM_OFM_ORDER.SAP_ORDER_NO FROM TM_VHC_VEHICLE LEFT JOIN TM_BAS_MATERIAL_RELATION ON TM_VHC_VEHICLE.MATERIAL_NO = TM_BAS_MATERIAL_RELATION.MATERIAL_NO LEFT JOIN TM_OFM_ORDER ON TM_VHC_VEHICLE.TM_OFM_ORDER_ID = TM_OFM_ORDER.TM_OFM_ORDER_ID WHERE TM_VHC_VEHICLE.vin =#{vin}")
    List<OnLineMakeVehicle> findOtherMessageByVin(@Param("vin") String vin);

    /**
     * 功能描述: <br>
     * <>
     *
     * @param:
     * @return:
     * @author:yuchao
     * @date: 2020/3/20 15:01
     */
    List<OnLineMakeVehicle> findByPoint(@Param("point") String point, @Param("vin") String vin);

    /**
     * 功能描述: 查询PBS段车辆信息 P11 -总装10点<br>
     * <>
     *
     * @param:
     * @return:
     * @author:yuchao
     * @date: 2020/3/20 15:02
     */
    List<OnLineMakeVehicle> findPbs(@Param("point") String point, @Param("vin") String vin);

    /**
     * 功能描述: 批量修改车辆状态<br>
     * <>
     *
     * @param:
     * @return:
     * @author:yuchao
     * @date: 2020/4/9 11:56
     */
    void batchUpdateVehicleStatus(@Param("vins") List<String> vins, @Param("state") String state);

    /**
     * 功能描述: 根据过点 状态 获取vin码<br>
     * <>
     *
     * @Param:[point, state]
     * @Return:java.util.List<java.lang.String>
     * @Author:yuchao
     * @Date: 2020/4/19 22:51
     */
    @Select("SELECT DISTINCT vin  from KY_BDC_VEHICLE  where STATE =#{state} and POINT=#{point}")
    List<String> findByPointAndState(@Param("point") String point, @Param("state") String state);
}